package fr.iut2.sil1.trolledit.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;


public class ApercuTroll extends Composite {
	
	private VerticalPanel vPanelPrincipal = new VerticalPanel();
	private VerticalPanel panelImage = new  VerticalPanel();
	private Image imgApercu = new Image("img/troll-default.jpg");
	//sert a rien 
	private TextBox textBox = new TextBox();
	private Button buttonValid = new Button("Valider");
	private HorizontalPanel hPanelTextBox = new HorizontalPanel();
	
	private static ApercuTroll SINGLETON;
	
	//Constructor
	public ApercuTroll(){
		//this.hPanelTextBox.add(this.textBox);
		//this.hPanelTextBox.add(this.buttonValid);
		this.panelImage.add(imgApercu);
		this.vPanelPrincipal.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
		this.vPanelPrincipal.add(this.panelImage);
		this.vPanelPrincipal.add(this.hPanelTextBox);
		SINGLETON = this;
		this.initWidget(this.vPanelPrincipal);
	}
	
	//Fonction qui ajoute une image dans le panel d'apercu
	public void setNewApercu(Troll t){
		this.panelImage.clear();
		this.imgApercu.setUrl(t.getImage());
		this.imgApercu.setPixelSize(300, 300);
		this.imgApercu.setTitle(t.getNom());
		//this.textBox.setText(t.getNom());
		this.panelImage.add(this.imgApercu);
	}
	
	//Set text in textbox for description
	/*
	public void setDescription(String description){
		textBox.setText(description);
	}
	*/
	
	public VerticalPanel getvPanelPrincipal() {
		return vPanelPrincipal;
	}


	public void setvPanelPrincipal(VerticalPanel vPanelPrincipal) {
		this.vPanelPrincipal = vPanelPrincipal;
	}

	public VerticalPanel getPanelImage() {
		return panelImage;
	}


	public void setPanelImage(VerticalPanel panelImage) {
		this.panelImage = panelImage;
	}


	public TextBox getTextBox() {
		return textBox;
	}


	public void setTextBox(TextBox textBox) {
		this.textBox = textBox;
	}


	public Button getButtonValid() {
		return buttonValid;
	}


	public void setButtonValid(Button buttonValid) {
		this.buttonValid = buttonValid;
	}


	public HorizontalPanel gethPanelTextBox() {
		return hPanelTextBox;
	}


	public void sethPanelTextBox(HorizontalPanel hPanelTextBox) {
		this.hPanelTextBox = hPanelTextBox;
	}

	public static ApercuTroll getSINGLETON() {
		return SINGLETON;
	}


	public static void setSINGLETON(ApercuTroll sINGLETON) {
		SINGLETON = sINGLETON;
	}

	public Image getImgApercu() {
		return imgApercu;
	}

	public void setImgApercu(Image imgApercu) {
		this.imgApercu = imgApercu;
	}
	

}
